package com.cy.pj.common.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 用于封装分页信息的pojo对象
 */
@Data
@NoArgsConstructor
public class PageObject<T> implements Serializable {
    private static final long serialVersionUID = -5307436796659944757L;
    /** 总记录数 */
    private  Integer rowCount;
    /** 当前页记录 */
    private List<T> records;
    /** 总页数 */
    private Integer pageCount;
    /** 显示条数 */
    private Integer pageSize;
    /** 当前页码值 */
    private Integer pageCurrent;

    public PageObject(Integer pageCurrent, Integer pageSize,Integer rowCount, List<T> records ) {
        this.rowCount = rowCount;
        this.records = records;
        this.pageSize = pageSize;
        this.pageCurrent = pageCurrent;
        this.pageCount=rowCount/pageSize;
        if(rowCount%pageSize!=0)this.pageCount++;
    }
}
